/**
 * Captain
 * © 2018 Captain copyright，All rights reserved.
 * http://www.sccaptain.com.cn
 * 
 * JAVA : 8
 * 文  件  名: ImageServiceImpl.java
 * 创  建  人: QinYoubin (qin.youbin@sccaptain.com.cn)
 * 创建时间: 2018年5月2日 上午11:04:49
 * 版         本: 1.0.0
 * 备         注:
 * 修订历史:
 */
package com.material.c2c.img.service;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

import com.cpt.framework.core.OperationResult;
import com.material.c2c.core.UUIDGenerator;
import com.material.c2c.img.dao.ImageDao;
import com.material.c2c.img.entity.TPXX;

/**
 * 图片服务层
 * @since 1.0
 * @version 1.0
 * @author QinYoubin (qin.youbin@sccaptain.com.cn)
 */
@Service
public class ImageServiceImpl implements ImageService{
  @Resource
  private ImageDao imageDao;
  
  @Override
  public TPXX getOne(String id) {
    return imageDao.getOne(id);
  }
  
  @Override
  @Transactional
  public OperationResult add(TPXX tpxx) {
    tpxx.setId(UUIDGenerator.generateUUIDStr());
    tpxx = imageDao.add(tpxx);
    if(tpxx == null) {
      return OperationResult.failed("图片添加失败！");
    }
    return OperationResult.SUCCEED;
  }
}
